<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #box1 {
            width: 300px;
            height: 300px;
            background-color: red;
        }
        #box2 {
            width: 200px;
            height: 200px;
            background-color: green;;
        }
        #box3 {
            width: 100px;
            height: 100px;
            background-color: yellow;;
        }
    </style>
    <script src="jquery-3.3.1.min.js"></script>
    <script>
        $(function(){
            $("#box1").click(function(){
                console.log($(this).attr("id"));
            });
            $("#box2").click(function(){
                console.log($(this).attr("id"));
                // 阻止事件冒泡
                return false;
            });
            $("#box3").click(function(){
                console.log($(this).attr("id"));
                // 阻止事件冒泡                
                return false;
            });
        });
    </script>
</head>
<body>
    <div id="box1">
        <div id="box2">
            <div id="box3"></div>
        </div>
    </div>
    
</body>
</html>